<link rel="stylesheet" type="text/css" href="__STATIC__/admin_page/static/h-ui/css/H-ui.min.css"/>
<link rel="stylesheet" type="text/css" href="__STATIC__/admin_page/static/h-ui.admin/css/H-ui.admin.css"/>
<link rel="stylesheet" type="text/css" href="__STATIC__/admin_page/lib/Hui-iconfont/1.0.8/iconfont.css"/>
<link rel="stylesheet" type="text/css" href="__STATIC__/admin_page/static/h-ui.admin/skin/default/skin.css" id="skin"/>
<link rel="stylesheet" type="text/css" href="__STATIC__/admin_page/static/h-ui.admin/css/style.css"/>
<script type="text/javascript" src="/static/js/vue2.5.1.js"></script>
<script src="/static/js/axios.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin_page/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin_page/lib/layer/2.4/layer.js"></script>
<script src="/static/js/jquery.base64.js"></script>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=60eIAsFrAGFAlSnWv0W8okwv8tngCX93"></script>
<div class="page-container" id="password">
    <article class="cl pd-20">
        <form action="" method="post" class="form form-horizontal" id="form-member-add">
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>用户类型：</label>
                <div class="formControls col-xs-8 col-sm-5"> <span class="select-box" style="width:150px;">
			<select class="select" v-model="user_type" name="user_type" size="1">
			    <option value="1">商家</option>
				<option value="2">买家</option>
			</select>
			</span></div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>账号数量：</label>
                <div class="formControls col-xs-8 col-sm-3">
                    <input type="number" v-model="number" class="input-text" placeholder="请输入需要生成的账号数量" name="number"
                           readonly>
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>邮箱规则：</label>
                <div class="formControls col-xs-8 col-sm-3">
                    <input readonly type="email" class="input-text" v-model="email" placeholder="请输入确认密码"
                           name="email">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>用户昵称：</label>
                <div class="formControls col-xs-8 col-sm-3">
                    <input type="text" class="input-text" v-model="user_nickname" placeholder="请输入用户昵称"
                           name="email">
                </div>
            </div>
         <!--   <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>公司选择：</label>
                <div class="formControls col-xs-8 col-sm-5"> <span class="select-box" style="width:150px;">
			<select class="select" v-model="longLat" name="longLat" size="1">
				<option value="1">国内</option>
				<option value="2">国外</option>
			</select>
			</span>
                </div>
            </div>-->
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>经度,纬度：</label>
                <div class="formControls col-xs-8 col-sm-3">
                    <input type="text" v-model="lng" name="lng" class="input-text"><span><a style="color: red"
                                                                                            target="_blank"
                                                                                            href="http://api.map.baidu.com/lbsapi/getpoint/index.html">点击获取</a></span>
                    <span> 示例: 116.502579,39.987282 </span></div>
            </div>
            <div class="row cl">
                <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                    <input class="btn btn-primary radius" v-show="is_show" @click="member_add" value="提交">
                    <input class="btn btn-danger radius" v-show="!is_show" value="用户生成中....,请耐心等待">
                    <input class="btn btn-primary radius" onClick="javascript :history.back(-1);" value="返回上一页">
                </div>
            </div>

        </form>
    </article>
</div>

<script>
    var app = new Vue({
        el: '#password',
        data: {
            user_type: 1,
            number: 1,
            email: 'service_',
            is_show: true,
            longLat: 1,
            user_nickname: '',
            lat: '',
            lng: '',
        },
        created() {

        },
        methods: {
            //注册会员
            member_add: function () {
                if (this.number > 10) {
                    layer.alert('一次最多生成10个')
                    return false;
                }
                this.is_show = false;
                if (this.lng.length < 0) {
                    layer.alert('经纬度必填')
                }
                axios.post('/admin/User/SendUser',
                    {
                        user_type: this.user_type,
                        number: this.number,
                        request_type: 'h5',
                        email: this.email,
                        user_nickname: this.user_nickname,
                        lng: this.lng,
                    }
                ).then(response => {
                    if (response.data.status == 200) {
                        window.location = '/admin/User/index';
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                    } else {
                        layer.alert(response.data.msg)
                    }
                })
            },
            cancle_layer: function () {
                window.location = ''
            }
        }
    });
</script>

